#计算肠外营养

import sympy
import pyperclip

p_name = "5%氨基酸18AA"
f_name = '20%长链脂肪乳'
g10_name = '10%葡萄糖'
g50_name = '50%葡萄糖'
n_name = '10%氯化钠'
k_name = '10%氯化钾最大量'

age, weight = input("请输入年龄 体重:\n").split()
age = int(age)
weight = int(weight)
# 液体总量系数 f_rate
# 热卡总量系数 k_rate
age_map = [
    {"age": (0, 0.99), "f_rate": 100, "k_rate": 100}, 
    {"age": (1, 3), "f_rate": 90, "k_rate": 100}, 
    {"age": (4, 6), "f_rate": 80, "k_rate": 90}, 
    {"age": (7, 9), "f_rate": 60, "k_rate": 80}, 
    {"age": (10, 14), "f_rate": 60, "k_rate": 60}, 
]
for each in age_map:
    if each['age'][0]<= age <= each['age'][1]:
        f_rate = each['f_rate']
        k_rate = each['k_rate']
        break

# 总液体量 total_f
total_f = f_rate*weight
# 总热量
total_k = k_rate*weight
# 5%氨基酸量
p_g = weight*2
p_k = p_g * 4
p_dot = 1*weight*20
# 20%脂肪乳量
f_g = weight*1
f_k = p_g * 9
f_dot = 1*weight*5
# 葡萄糖
g_k = total_k-p_k-f_k
# 葡萄糖g数
g_g = g_k//4
# 葡萄糖总量
total_g_f = total_f-p_dot-f_dot

g10, g50 = sympy.symbols('g10 g50')
result = sympy.solve([g10*0.1+g50*0.5-g_g, g10+g50-total_g_f])
print(result, total_f, total_k, g_g)

# 1/5张力 n_dot_5 
# 1/4张力 n_dot_4 
# 1/3张力 n_dot_3
n_dot_5 = total_f * 0.009 * 0.2 * 10
n_dot_4 = total_f * 0.009 * 0.25 * 10
n_dot_3 = total_f * 0.009 * 0.33 * 10
# 10%KCl最大量
k_dot = total_f * 0.01 * 0.3 * 10